-
Notifications
You must be signed in to change notification settings - Fork 748
[llm] Beef up wav loader to read audio format 3 (float format) #15452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR adds test coverage for WAV files using audio format 3 (IEEE float format), which allows direct reading of float values without normalization. The existing `**wav_loader.h**` implementation already supports this format (lines 179-185), but there was no test coverage for this code path.
**Test additions in `**test_wav_loader.cpp**`:**
1. Added `append_float()` helper function to serialize float values into byte arrays
2. Added `make_float_wav_bytes()` helper function to generate WAV files with audio format 3 (IEEE float)
3. Added `LoadAudioDataFloatFormatReadsDirectly` test case that verifies:
* WAV header correctly identifies audio format as 3
* Float samples are read directly without normalization
* Output float values match the input exactly
The new test case `LoadAudioDataFloatFormatReadsDirectly` validates that:
* A WAV file with audio format 3 (IEEE float, 32-bit) is correctly parsed
* The audio format is detected as 3 in the header
* Float values [0.0f, 0.5f, -0.5f, 1.0f, -1.0f] are read directly without normalization
* All float values match exactly using `EXPECT_FLOAT_EQ`
Run the test with:
`buck2 test //extension/llm/runner/test:test_wav_loader`
The WAV loader already has logic to handle IEEE float format (audio format 3) differently from PCM integer formats, but this code path was not covered by tests. This test ensures the float format path works correctly and prevents regressions.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/15452
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit d177c64 with merge base efc2be7 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Gasoonjia
approved these changes
Oct 29, 2025
Gasoonjia
reviewed
Oct 29, 2025
msluszniak
reviewed
Oct 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
release notes: llm
Changes to llm utilities
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables audio format 3 (IEEE float format) on
wav_loader.h, which allows direct reading of float values without normalization. Also adds a unit test.